class Tag < ApplicationRecord
  has_many :blogs_tags, class_name: 'BlogsTags'
  # through 通过另外一个关联完成当前关联
  has_many :blogs, through: :blogs_tags
  validates :title, presence: {message: '标题不能为空'}
  validates :title, uniqueness: {message: '标签已存在'}
end
